Optimal. Leaf size=236 \[ -\frac {\left (\frac {1}{4}-\frac {i}{4}\right ) (A+(2-i) B) \tan ^{-1}\left (1-\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a d}+\frac {\left (\frac {1}{4}-\frac {i}{4}\right ) (A+(2-i) B) \tan ^{-1}\left (\sqrt {2} \sqrt {\tan (c+d x)}+1\right )}{\sqrt {2} a d}+\frac {(-B+i A) \sqrt {\tan (c+d x)}}{2 d (a+i a \tan (c+d x))}+\frac {\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B) \log \left (\tan (c+d x)-\sqrt {2} \sqrt {\tan (c+d x)}+1\right )}{\sqrt {2} a d}-\frac {\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B) \log \left (\tan (c+d x)+\sqrt {2} \sqrt {\tan (c+d x)}+1\right )}{\sqrt {2} a d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.29, antiderivative size = 236, normalized size of antiderivative = 1.00, number of steps used = 11, number of rules used = 8, integrand size = 36, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.222, Rules used = {3595, 3534, 1168, 1162, 617, 204, 1165, 628} \[ -\frac {\left (\frac {1}{4}-\frac {i}{4}\right ) (A+(2-i) B) \tan ^{-1}\left (1-\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a d}+\frac {\left (\frac {1}{4}-\frac {i}{4}\right ) (A+(2-i) B) \tan ^{-1}\left (\sqrt {2} \sqrt {\tan (c+d x)}+1\right )}{\sqrt {2} a d}+\frac {(-B+i A) \sqrt {\tan (c+d x)}}{2 d (a+i a \tan (c+d x))}+\frac {\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B) \log \left (\tan (c+d x)-\sqrt {2} \sqrt {\tan (c+d x)}+1\right )}{\sqrt {2} a d}-\frac {\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B) \log \left (\tan (c+d x)+\sqrt {2} \sqrt {\tan (c+d x)}+1\right )}{\sqrt {2} a d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 204
Rule 617
Rule 628
Rule 1162
Rule 1165
Rule 1168
Rule 3534
Rule 3595
Rubi steps
\begin {align*} \int \frac {\sqrt {\tan (c+d x)} (A+B \tan (c+d x))}{a+i a \tan (c+d x)} \, dx &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{2 d (a+i a \tan (c+d x))}-\frac {\int \frac {\frac {1}{2} a (i A-B)-\frac {1}{2} a (A-3 i B) \tan (c+d x)}{\sqrt {\tan (c+d x)}} \, dx}{2 a^2}\\ &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{2 d (a+i a \tan (c+d x))}-\frac {\operatorname {Subst}\left (\int \frac {\frac {1}{2} a (i A-B)-\frac {1}{2} a (A-3 i B) x^2}{1+x^4} \, dx,x,\sqrt {\tan (c+d x)}\right )}{a^2 d}\\ &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{2 d (a+i a \tan (c+d x))}-\frac {\left (\left (\frac {1}{4}+\frac {i}{4}\right ) (A-(2+i) B)\right ) \operatorname {Subst}\left (\int \frac {1-x^2}{1+x^4} \, dx,x,\sqrt {\tan (c+d x)}\right )}{a d}--\frac {\left (\left (\frac {1}{4}-\frac {i}{4}\right ) (A+(2-i) B)\right ) \operatorname {Subst}\left (\int \frac {1+x^2}{1+x^4} \, dx,x,\sqrt {\tan (c+d x)}\right )}{a d}\\ &=\frac {(i A-B) \sqrt {\tan (c+d x)}}{2 d (a+i a \tan (c+d x))}--\frac {\left (\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B)\right ) \operatorname {Subst}\left (\int \frac {\sqrt {2}+2 x}{-1-\sqrt {2} x-x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{\sqrt {2} a d}--\frac {\left (\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B)\right ) \operatorname {Subst}\left (\int \frac {\sqrt {2}-2 x}{-1+\sqrt {2} x-x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{\sqrt {2} a d}--\frac {\left (\left (\frac {1}{8}-\frac {i}{8}\right ) (A+(2-i) B)\right ) \operatorname {Subst}\left (\int \frac {1}{1-\sqrt {2} x+x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{a d}--\frac {\left (\left (\frac {1}{8}-\frac {i}{8}\right ) (A+(2-i) B)\right ) \operatorname {Subst}\left (\int \frac {1}{1+\sqrt {2} x+x^2} \, dx,x,\sqrt {\tan (c+d x)}\right )}{a d}\\ &=\frac {\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B) \log \left (1-\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{\sqrt {2} a d}-\frac {\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B) \log \left (1+\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{\sqrt {2} a d}+\frac {(i A-B) \sqrt {\tan (c+d x)}}{2 d (a+i a \tan (c+d x))}--\frac {\left (\left (\frac {1}{4}-\frac {i}{4}\right ) (A+(2-i) B)\right ) \operatorname {Subst}\left (\int \frac {1}{-1-x^2} \, dx,x,1-\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a d}-\frac {\left (\left (\frac {1}{4}-\frac {i}{4}\right ) (A+(2-i) B)\right ) \operatorname {Subst}\left (\int \frac {1}{-1-x^2} \, dx,x,1+\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a d}\\ &=-\frac {\left (\frac {1}{4}-\frac {i}{4}\right ) (A+(2-i) B) \tan ^{-1}\left (1-\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a d}+\frac {\left (\frac {1}{4}-\frac {i}{4}\right ) (A+(2-i) B) \tan ^{-1}\left (1+\sqrt {2} \sqrt {\tan (c+d x)}\right )}{\sqrt {2} a d}+\frac {\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B) \log \left (1-\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{\sqrt {2} a d}-\frac {\left (\frac {1}{8}+\frac {i}{8}\right ) (A-(2+i) B) \log \left (1+\sqrt {2} \sqrt {\tan (c+d x)}+\tan (c+d x)\right )}{\sqrt {2} a d}+\frac {(i A-B) \sqrt {\tan (c+d x)}}{2 d (a+i a \tan (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 1.83, size = 198, normalized size = 0.84 \[ \frac {(\cos (d x)+i \sin (d x)) (A+B \tan (c+d x)) \left (4 (A+i B) \sin (c+d x) (\sin (d x)+i \cos (d x))+(1+i) (-\sin (c)+i \cos (c)) \sqrt {\sin (2 (c+d x))} \sec (c+d x) \left ((A+(2-i) B) \sin ^{-1}(\cos (c+d x)-\sin (c+d x))+i (A-(2+i) B) \log \left (\sin (c+d x)+\sqrt {\sin (2 (c+d x))}+\cos (c+d x)\right )\right )\right )}{8 d \sqrt {\tan (c+d x)} (a+i a \tan (c+d x)) (A \cos (c+d x)+B \sin (c+d x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.72, size = 570, normalized size = 2.42 \[ -\frac {{\left (a d \sqrt {\frac {i \, A^{2} + 2 \, A B - i \, B^{2}}{a^{2} d^{2}}} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (\frac {2 \, {\left ({\left (a d e^{\left (2 i \, d x + 2 i \, c\right )} + a d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {i \, A^{2} + 2 \, A B - i \, B^{2}}{a^{2} d^{2}}} + {\left (A - i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{i \, A + B}\right ) - a d \sqrt {\frac {i \, A^{2} + 2 \, A B - i \, B^{2}}{a^{2} d^{2}}} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (-\frac {2 \, {\left ({\left (a d e^{\left (2 i \, d x + 2 i \, c\right )} + a d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {i \, A^{2} + 2 \, A B - i \, B^{2}}{a^{2} d^{2}}} - {\left (A - i \, B\right )} e^{\left (2 i \, d x + 2 i \, c\right )}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{i \, A + B}\right ) - 2 \, a d \sqrt {\frac {i \, B^{2}}{a^{2} d^{2}}} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (\frac {{\left ({\left (a d e^{\left (2 i \, d x + 2 i \, c\right )} + a d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {i \, B^{2}}{a^{2} d^{2}}} + i \, B\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{a d}\right ) + 2 \, a d \sqrt {\frac {i \, B^{2}}{a^{2} d^{2}}} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (-\frac {{\left ({\left (a d e^{\left (2 i \, d x + 2 i \, c\right )} + a d\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}} \sqrt {\frac {i \, B^{2}}{a^{2} d^{2}}} - i \, B\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{a d}\right ) - 2 \, {\left ({\left (i \, A - B\right )} e^{\left (2 i \, d x + 2 i \, c\right )} + i \, A - B\right )} \sqrt {\frac {-i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}}\right )} e^{\left (-2 i \, d x - 2 i \, c\right )}}{8 \, a d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [F] time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {{\left (B \tan \left (d x + c\right ) + A\right )} \sqrt {\tan \left (d x + c\right )}}{i \, a \tan \left (d x + c\right ) + a}\,{d x} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.46, size = 192, normalized size = 0.81 \[ -\frac {i \arctan \left (\frac {2 \left (\sqrt {\tan }\left (d x +c \right )\right )}{\sqrt {2}+i \sqrt {2}}\right ) B}{d a \left (\sqrt {2}+i \sqrt {2}\right )}+\frac {\arctan \left (\frac {2 \left (\sqrt {\tan }\left (d x +c \right )\right )}{\sqrt {2}+i \sqrt {2}}\right ) A}{d a \left (\sqrt {2}+i \sqrt {2}\right )}+\frac {i \left (\sqrt {\tan }\left (d x +c \right )\right ) B}{2 d a \left (\tan \left (d x +c \right )-i\right )}+\frac {\left (\sqrt {\tan }\left (d x +c \right )\right ) A}{2 d a \left (\tan \left (d x +c \right )-i\right )}-\frac {2 i \arctan \left (\frac {2 \left (\sqrt {\tan }\left (d x +c \right )\right )}{\sqrt {2}-i \sqrt {2}}\right ) B}{d a \left (\sqrt {2}-i \sqrt {2}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 8.51, size = 184, normalized size = 0.78 \[ -\mathrm {atan}\left (\frac {2\,a\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\,\sqrt {\frac {B^2\,1{}\mathrm {i}}{4\,a^2\,d^2}}}{B}\right )\,\sqrt {\frac {B^2\,1{}\mathrm {i}}{4\,a^2\,d^2}}\,2{}\mathrm {i}-\mathrm {atan}\left (\frac {4\,a\,d\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\,\sqrt {-\frac {B^2\,1{}\mathrm {i}}{16\,a^2\,d^2}}}{B}\right )\,\sqrt {-\frac {B^2\,1{}\mathrm {i}}{16\,a^2\,d^2}}\,2{}\mathrm {i}-\frac {2\,\sqrt {\frac {1}{16}{}\mathrm {i}}\,A\,\mathrm {atanh}\left (4\,\sqrt {\frac {1}{16}{}\mathrm {i}}\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\right )}{a\,d}+\frac {A\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}\,1{}\mathrm {i}}{2\,a\,d\,\left (1+\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )}-\frac {B\,\sqrt {\mathrm {tan}\left (c+d\,x\right )}}{2\,a\,d\,\left (1+\mathrm {tan}\left (c+d\,x\right )\,1{}\mathrm {i}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F] time = 0.00, size = 0, normalized size = 0.00 \[ - \frac {i \left (\int \frac {A \sqrt {\tan {\left (c + d x \right )}}}{\tan {\left (c + d x \right )} - i}\, dx + \int \frac {B \tan ^{\frac {3}{2}}{\left (c + d x \right )}}{\tan {\left (c + d x \right )} - i}\, dx\right )}{a} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________